const personal1=document.querySelector('.personal1')
const userdata={
    userId: 0,
    username: "string",
    password: "string",
    email: "string",
    mobile: "string",
    startWorkYear: 0,
    profession: "string",
    introduction: "string",
    company: "string",
    position: "string",
    interests: "string",
    avatar: "string"
}
function Getuserinfo(key){
    let xhr = new XMLHttpRequest();
    xhr.open(
        'GET',
        `http://43.136.111.27:8086/user/get/userinfo`
    )
    xhr.setRequestHeader('Authorization', `${key}`)
    xhr.send()
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4 && xhr.status === 200) {
            let response = JSON.parse(xhr.responseText);
            console.log(response)
            for(const key in response.data){
                if(userdata.hasOwnProperty(key)){
                    userdata[key]=response.data[key]
                }
            }
            console.log(userdata)
            greetingsection.innerHTML = `
                    <h3>上午好！${userdata.username}</h3>
                    <button class="signin-btn">去签到</button>
                `
            personal1.innerHTML=`
                    <button class="nav-button createCenter">创作者中心</button>
                    <button class="nav-button">会员</button>
                    <button class="nav-button avatar1">
                        <img src="${userdata.avatar}" alt="" style="width: 35px;height: 35px;border-radius: 50%" class="userAvatar">
                    </button>
                    <button class="nav-button">退出登录</button>
                `
        }
    }
}